In the packaging of integrated circuits, a plurality of top dies may be bonded on an interposer wafer, which comprises a plurality of interposers therein. After the bonding of the top dies, an underfill may be dispensed into the gaps between the top dies and the interposer wafer. A curing process may then be performed to cure the underfill. A molding compound can be applied to mold the top dies therein. The resulting interposer wafer and the top dies thereon are then sawed apart into a plurality of packages. The packages may then be bonded to package substrates.